package com.ms.game.slot.base;

import java.math.BigDecimal;

import com.ms.game.itembox.container.GameCardChecker;
import com.ms.player.Player;
import com.xpec.c4.game.common.Helper;
import com.xpec.c4.game.datamanager.agent.money.CoinType;

public class SlotBetInfo {
	/**
	 * 押注幣別
	 */
	public CoinType cointype;
	
	public int betCount;
	
	public int totalmoney;
	
	public String clientip;
	
	public String halltype;
	
	public Player player;
	
	public BigDecimal gainRate = BigDecimal.ONE; //初始為1
	
	public BigDecimal beformoney;
	
	public BigDecimal atfermoney;
	
	public String reelKey;
	
	public GameCardChecker gameCardChecker;
	
	/**
	 * 重置 gameCardChecker </br>
	 * 重置 一般機台卡 </br>
	 */
	public void resetGameCardChecker(){
		if(gameCardChecker == null || gameCardChecker.isNormalGameCard()){
			gameCardChecker = new GameCardChecker();
		}
	}
	
	/**
	 * 判斷結束金額是否足夠
	 */
	public boolean isAfterMoneyEnough(){
		if(atfermoney == null){
			return false;
		}
		
		return Helper.isGreaterEqual(atfermoney, getRealBetMoney());
	}
	
	/**
	 * 取得真正下注的金額
	 */
	public BigDecimal getRealBetMoney(){
		return GainRateSystem.getRealMoney(totalmoney, gainRate);
	}
	
	public BigDecimal getPlayMoney() {
		if (player == null) {
			return BigDecimal.ZERO;
		}

		return (player.isUseTrialCoin()) ? player.getTrialCoin() : player.getGoldCoin();
	}
}
